<template >
  <div>
    <meta name="referrer" content="no-referrer" />
    <div class="box" v-for="item in gameList" :key="item.gameid">
      <!-- <div class="logo"><img src="images/kun.png" />小黑子之家</div> -->
      <div class="logo"><img :src="item.img" />{{ item.gamename }}</div>
      <!-- <div class="msg">喜欢唱跳Rap篮球的小黑子</div> -->
      <div class="msg">{{ item.gamemsg }}</div>
      <el-button round icon="el-icon-s-promotion" @click="toPlay(item)"
        >去游戏</el-button
      >
    </div>
  </div>
</template>

<script>
export default {
  name: "GameHallChildView",
  props: {
    checktype: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      gameList: [{}],
      type: 0,
      count: 30,
    };
  },
  methods: {
    toPlay(item) {
      console.log(item);
      localStorage.setItem("gameItem", JSON.stringify(item.gameid));
      this.$router.push("/hall");
    },
    xxxy(type) {
      this.type = type;
      this.findGameByType();
      // console.log(this.gameList);
    },
    findGameByType() {
      this.$axios
        .get("/api/game-service/gamehall/findgametype", {
          params: {
            pid: this.type,
          },
        })
        .then((resp) => {
          this.gameList = resp.data.data;
        });
    },
  },
  created() {
    this.findGameByType();
  },
};
</script>

<style>
.box {
  width: 20%;
  border: 1px solid #e4ecf3;
  box-shadow: 1px 2px 3px #f2f6f8;
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  min-width: 160px;
  float: left;
  overflow: hidden;
  transition: all 0.3s;
  margin: 22px 0 15px 3%;
}
.box .logo {
  height: 40px;
  position: relative;
  font-size: 14px;
  font-weight: 700;
  color: #3273dc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.1rem;
}
.logo img {
  width: 30px;
  height: 30px;
}
.box .msg {
  color: gray;
  font-size: 12px;
  padding-top: 10px;
  height: 35px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
</style>